package com.dapeng.jackson.annotations;

import com.dapeng.jackson.enums.JKEnumMode;
import com.dapeng.jackson.serializer.JKEnumFormatDeserializer;
import com.fasterxml.jackson.annotation.JacksonAnnotationsInside;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;

import java.lang.annotation.*;

/**
 * @BelongProject study
 * @BelongPackage com.dapeng.jackson.annotations
 * @Description TODO
 * @ClassName JKEnumDeserializer
 * @Author xupenghong
 * @Date 2024/9/13 16:23
 * @Version 1.0.0
 */
@Inherited
@Retention(value = RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.METHOD})
@JsonDeserialize(using = JKEnumFormatDeserializer.class)
@JacksonAnnotationsInside
public @interface JKEnumDeserializer {

    /**
     * 序列化方式
     */
    JKEnumMode mode() default JKEnumMode.NAME;

    /**
     * 当序列化方式为FIELD生效，指定使用的字段名的返回值进行序列化
     */
    String fieldName() default "";

    /**
     * 是否允许反序列为空
     */
    boolean nullable() default true;

}

